import request from "@/utils/request";
import type { RequestParams, ResponseData, RobotRequestParams } from "./type";

// 分页列表
export const reportShelfWrongDataList = (data: RequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/reportShelfWrongData/page",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
export const workOrderAdd = (ids: any, taskNo: any, workName: any) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/workOrder/add",
    method: "post",
    data: { ids, taskNo, workName },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};

export const workOrderHandadd = (ids: RequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/workOrder/handadd",
    method: "post",
    data: { ids },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
/**
 * 十次列表数据
 * @param data {LoginData}
 * @returns
 */
export function tenOptions(aesKeyByRsa: string) {
  return request({
    url: `/api/v1/inventoryTask/options`,
    method: "post",
    data: aesKeyByRsa,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
}
// 控制任务
export const controlTaskChange = (controlType: any, orderId: any) => {
  return request<ResponseData<any>>({
    url: "/api/v1/workOrder/controlTask",
    method: "post",
    data: {
      controlType,
      orderId,
    },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 工单列表
export const workOrderList = (data: RequestParams) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/workOrder/page",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
/**
 * 导出
 *
 * @param queryParams
 * @returns
 */
export function exportUser(ids: any) {
  return request({
    url: `/api/v1/reportShelfWrongData/exportPdf`,
    method: "post",
    responseType: "arraybuffer",
    data: { ids },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
}
// 完成任务
export const update = (id: any) => {
  return request<ResponseData<RobotRequestParams>>({
    url: "/api/v1/workOrder/handupdate",
    method: "post",
    data: { id },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 还书箱下拉
export const optionsList = (data: RequestParams) => {
  return request<ResponseData<any>, any>({
    url: "/api/v1/box/options",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 分配还书箱
export const updateBox = (data: RequestParams) => {
  return request<ResponseData<any>, any>({
    url: "/api/v1/workOrder/updateBox",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 搜索
export const createpage = (data: RequestParams) => {
  return request<ResponseData<any>, any>({
    url: "/api/v1/reportShelfWrongData/createpage",
    method: "post",
    data,
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};

// 分配还书箱
export const handadd = (ids: RequestParams, workNo: any) => {
  return request<ResponseData<any>, any>({
    url: "/api/v1/workOrder/update",
    method: "post",
    data: { ids, workNo },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
// 删除工单图书
export const deleteBook = (ids: RequestParams, workNo: any) => {
  return request<ResponseData<any>, any>({
    url: "/api/v1/workOrder/deleteBook",
    method: "post",
    data: { ids, workNo },
    headers: {
      //需要加密的请求在头部塞入标识
      isEncrypt: 1,
    },
  });
};
